package com.appservice.controller;

import com.vidyu.businesslayer.businessentities.Contractor;
import com.vidyu.businesslayer.businessentities.Employer;
import com.vidyu.businesslayer.businessentities.Pair;
import com.vidyu.servicelayer.servicedataentitties.ContractorRO;
import com.vidyu.servicelayer.servicedataentitties.SkillsRO;
import com.vidyu.servicelayer.serviceinterface.ControllerServiceWrapper;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * Created by IntelliJ IDEA.
 * Session: eyalsa
 * Date: 06/03/12
 * Time: 16:11
 * Link Users To Agency
 */
@Controller
public class ContractorController {

    private static final Logger logger = Logger.getLogger(ContractorController.class);

    @Autowired
    ControllerServiceWrapper controllerServiceWrapperImpl;

    //http://localhost:8081/vidyu/contract/get/1
    @RequestMapping(value = "/vidyu/contract/get/{id}",method = RequestMethod.GET)
    public @ResponseBody
    Pair<String, String> getContract(@PathVariable long id) throws Exception{
        try {
            return controllerServiceWrapperImpl.getContract(id);
        } catch (Exception e) {
            logger.fatal(e);
            throw e;
        }
    }

    //http://localhost:8081/vidyu/contract/getAllContractTitles
    @RequestMapping(value = "/vidyu/contract/getAllContractTitles",method = RequestMethod.GET)
    public @ResponseBody
    List<Pair<Long, String>> getAllContractTitles()throws Exception {
        try {
            return controllerServiceWrapperImpl.getAllContractTitles();
        } catch (Exception e) {
            logger.fatal(e);
            throw e;
        }
    }
}

